package org.nepu.srr.设备设施资料.船级及法定证书;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.nepu.sc.domain.CommonMethods;
import org.nepu.sc.domain.DataVO;

import javax.persistence.Column;
import javax.persistence.Convert;

@Data
public class B41ShipParams {
    @ApiModelProperty(value = "船舶国籍证书")
    DataVO nationalityCertificate;

    @ApiModelProperty(value = "企业法人营业执照")
    DataVO businessLicenseCertificate;

    @ApiModelProperty(value = "船舶所有权登记证书")
    DataVO shipOwnerCertificate;

    @ApiModelProperty(value = "船舶电台执照")
    DataVO radioCertificate;

    @ApiModelProperty(value = "海上移动平台入级证书及其附件")
    DataVO platformIntroductionCertificate;

    @ApiModelProperty(value = "海上移动平台安全证书及其附件")
    DataVO platformSecurityCertificate;

    @ApiModelProperty(value = "国际防止油污证书及其附件")
    DataVO oilPollutionPreventionCertificate;

    @ApiModelProperty(value = "国际防止生活污水污染证书")
    DataVO environmentalProtectionCertificate;

    @ApiModelProperty(value = "国际防止空气污染证书及其附件")
    DataVO airProtectionCertificate;

    @ApiModelProperty(value = "国际载重线证书")
    DataVO internationalLoadLineCertificate;

    @ApiModelProperty(value = "国际吨位证书及其附件")
    DataVO internationalShippingCertificate;

    @ApiModelProperty(value = "起重设备检验和试验证书")
    DataVO deviceInspectionCertificate;

    @ApiModelProperty(value = "船舶起重和起吊设备检验簿")
    DataVO shipEquipmentInspectionCertificate;

    @ApiModelProperty(value = "适拖证书")
    DataVO dragLineCertificate;

    @ApiModelProperty(value = "符合证明11")
    DataVO proofCertificate11;
    //
    @ApiModelProperty(value = "安全管理证书")
    DataVO safetyManagementCertificate11;

    @ApiModelProperty(value = "安全生产作业许可证")
    DataVO safetyProductionCertificate;

    @ApiModelProperty(value = "防止船舶垃圾污染检验证明")
    DataVO shipWastePreventionCertificate;

    @ApiModelProperty(value = "燃油污染损害民事责任保险或其他财务保证书")
    DataVO insuranceCertificate;

    @ApiModelProperty(value = "作业设施安全检查备案通知书")
    DataVO facilityInspectionCertificate;

    @ApiModelProperty(value = "船舶免于卫生控制措施证书")
    DataVO healthPreventionCertificate11;

    @ApiModelProperty(value = "船舶最低安全配员证书")
    DataVO minSecurityCrewCertificate;

    @ApiModelProperty(value = "活动零部件检验和试验证书")
    DataVO activityPartInspectionCertificate;

    @ApiModelProperty(value = "飞机坪运行许可函")
    DataVO runwayCertificate;

    public B41ShipResult rate(){
        double fullScore = 240;
        double score = 0;
        if(nationalityCertificate.getData().equals("合格")){
            score += 10;
        }
        if(businessLicenseCertificate.getData().equals("合格")){
            score += 10;
        }
        if(shipOwnerCertificate.getData().equals("合格")){
            score += 10;
        }
        if(radioCertificate.getData().equals("合格")){
            score += 10;
        }
        if(platformIntroductionCertificate.getData().equals("合格")){
            score += 10;
        }
        if(platformSecurityCertificate.getData().equals("合格")){
            score += 10;
        }
        if(oilPollutionPreventionCertificate.getData().equals("合格")){
            score += 10;
        }
        if(environmentalProtectionCertificate.getData().equals("合格")){
            score += 10;
        }
        if(airProtectionCertificate.getData().equals("合格")){
            score += 10;
        }
        if(internationalLoadLineCertificate.getData().equals("合格")){
            score += 10;
        }
        if(internationalShippingCertificate.getData().equals("合格")){
            score += 10;
        }
        if(deviceInspectionCertificate.getData().equals("合格")){
            score += 10;
        }
        if(shipEquipmentInspectionCertificate.getData().equals("合格")){
            score += 10;
        }
        if(dragLineCertificate.getData().equals("合格")){
            score += 10;
        }
        if(proofCertificate11.getData().equals("合格")){
            score += 10;
        }
        if(safetyManagementCertificate11.getData().equals("合格")){
            score += 10;
        }
        if(safetyProductionCertificate.getData().equals("合格")){
            score += 10;
        }
        if(shipWastePreventionCertificate.getData().equals("合格")){
            score += 10;
        }
        if(insuranceCertificate.getData().equals("合格")){
            score += 10;
        }
        if(facilityInspectionCertificate.getData().equals("合格")){
            score += 10;
        }
        if(healthPreventionCertificate11.getData().equals("合格")){
            score += 10;
        }
        if(minSecurityCrewCertificate.getData().equals("合格")){
            score += 10;
        }
        if(activityPartInspectionCertificate.getData().equals("合格")){
            score += 10;
        }
        if(runwayCertificate.getData().equals("合格")){
            score += 10;
        }
        double rate = score / fullScore;
        B41ShipResult result = new B41ShipResult();
        result.setRateScore(rate);
        String s = CommonMethods.toGrade(rate);
        result.setRateResult(s);
        return result;
    }
}
